package bishihuizong;

import sun.plugin.javascript.navig.Array;

import java.util.*;

/**
 * Created by JiaJia on 2019/9/17 0017.
 */
public class Baidu01 {
    public static void main(String[] args) {
        /*Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            int t=scanner.nextInt();
        }*/

    }
    private static List<Integer>[] builConnect(int[][] path,int n,int m){
        List<Integer>[] connect=new List[n+1];
        for (int i = 1; i <=n ; i++) {
            connect[i]=new ArrayList<>();
            for (int[] num:path) {
                if (num[0]==i){
                    connect[i].add(num[1]);
                }
            }
        }
        return connect;
    }
    private static int judgeArrive(List<Integer>[] connect,int start,int end){
        Queue<Integer> queue=new LinkedList<>();
        boolean[] marked=new boolean[end+1];
        queue.add(start);
        int path=1;
        while (!queue.isEmpty()){
            int size=queue.size();
            path++;
            while (size-->0){
                int cur=queue.poll();
                for (int next:connect[cur]) {
                    if (next==end){
                        return path;
                    }
                    if (marked[next]){
                        continue;
                    }
                    marked[next]=true;
                    queue.add(next);
                }
            }
        }
        return 0;
    }

}